package businessLogic;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import Beans.Azienda;
import Beans.Sede;
import Beans.Ufficio;

import connessioni.MyConnection;

public class GestioneAziendeMySQL extends GestioneAziendeEmpty {
	
	private Connection con;
	
	public GestioneAziendeMySQL() throws SQLException, ClassNotFoundException {
		con = MyConnection.getConnection();
	}
	
	
	public void aggiungiAzienda(Azienda a) throws SQLException {
		
		Statement st = con.createStatement();
		
		st.executeUpdate("insert into aziende(Nome, PIva, Email, TipoPartner, TipoAzienda, Note, " + 
				"Sito, Brand, PathImg) "
				        + "values('" + a.getNome() + "', '" + a.getPIva() + "', "
				        + "'" + a.getEmail() + "', " + a.getPartner().getID() + ", " + a.getTipoAzienda() + ", "
				        + "'" + a.getNote() +  "', '" + a.getSito() + "', '" + a.getBrand() + "', '" + a.getPathImg() + "')");
		st.close();
		
	}
	
	
	

}
